// pages/my/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    token: '',
    role_menu_1: [{
        title: '业务管理',
        menu: [{
            label: '单元管理',
            icon: '/icons/danyuan.png',
            url: '/pages/estate/house/index/index'
          },
          {
            label: '户号管理',
            icon: '/icons/fangjian.png',
            url: '/pages/estate/room/index/index'
          },
          {
            label: '车位管理',
            icon: '/icons/chewei.png',
            url: '/pages/estate/car/index/index'
          },
          {
            label: '物业缴费',
            icon: '/icons/jiaofei.png',
            url: '/pages/estate/fee/index/index'
          }
        ]
      }, {
        title: '基础管理',
        menu: [
          {
            label: '巡检排查',
            icon: '/icons/cunjian.png',
            url: '/pages/estate/check/index/index'
          },
          {
            label: '公告管理',
            icon: '/icons/gonggao.png',
            url: '/pages/estate/notice/index/index'
          },
          {
            label: '用户管理',
            icon: '/icons/yonghu.png',
            url: '/pages/estate/user/index/index'
          },
          {
            label: '投诉建议',
            icon: '/icons/tousujianyi.png',
            url: '/pages/estate/advice/index/index'
          }
        ]
      }
    ],
    role_menu_2: [{
      title: '我的管理',
      menu: [{
          label: '我的户号',
          icon: '/icons/danyuan.png',
          url: '/pages/my/house/index/index'
        },
        {
          label: '我的车位',
          icon: '/icons/chewei.png',
          url: '/pages/my/car/index/index'
        },
        {
          label: '访客管理',
          icon: '/icons/fangjian.png',
          url: '/pages/my/visitor/index/index'
        },
        {
          label: '缴纳物业',
          icon: '/icons/jiaofei.png',
          url: '/pages/my/fee/index/index'
        }
      ]
    }
  ],
  },

  // 此处一进入页面会调用
  onShow() {
    let self = this;
    if (wx.getStorageSync('token')) {
      self.setData({
        role:  wx.getStorageSync('role'),
        token: wx.getStorageSync('token')
      })
    }
  },

  toLogin() {
    // 跳转去登录页面
    wx.navigateTo({
      url: '/pages/login/index/index',
    })
  },

  toQuit() {
    wx.clearStorage()
    wx.navigateTo({
      url: '/pages/login/index/index',
    })
  }
})